package com.springboot.test.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum GoodsStatus {
    AUDIT(0,"未审核"),
    PUBLISH(1,"已发布"),
    NO_PUBLISH(2,"未发布"),
    TRADE(3,"已交易"),
    NO_AUDIT(4,"审核未通过"),
    WAIT_TRADE(5,"待交易")
    ;
    Integer code;
    String describe;

    public static GoodsStatus getByCode(Integer code){
        if(null == code){
            return null;
        }
        for (GoodsStatus value : GoodsStatus.values()) {
            if(code.equals(value.getCode())){
                return value;
            }
        }
        return null;
    }

}
